package com.lwl.blog.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lwl.blog.system.entity.SystemUserEntity;
import com.lwl.blog.system.mapper.SystemUserMapper;
import com.lwl.blog.system.service.ISystemUserService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户管理系统服务层实现类
 * </p>
 *
 * @author lwl
 * @since 22-12-23
 */

@Service
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUserEntity> implements ISystemUserService {

    //查询用户名是否存在
    @Override
    public SystemUserEntity getByUsername(String username) {

        //使用选择构造器
        QueryWrapper<SystemUserEntity> qw = new QueryWrapper<>();
        qw.eq("username",username);
        //交给mp去查询数据库看是否存在
        return baseMapper.selectOne(qw);
    }
}
